import ajax from './ajax';
import mockAjax from './mockAjax';

// 1 发送请求，获取三级分类列表数据
export const reqCategoryListData = ()=>ajax.get('/product/getBaseCategoryList')

// 2 获取轮播图的接口函数
export const reqGetBannerListData = () => mockAjax.get('/bannerList')

// 3 获取楼层数据的接口函数
export const reqGetFloorsListData = ()=> mockAjax.get('/floorsList')

// 4 获取search页面的相关数据的接口函数
export const reqGetSearchGoodsInfoData = searchParams => ajax.post('/list', searchParams)

// 5 获取商品详情数据
export const reqGetGoodsDetailInfoData = skuId => ajax.get(`/item/${ skuId }`)

// 6 添加或者更新商品 到购物车中
export const reqAddOrUpdateSkuInfoToShopCart = (skuId, skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`);

// 7 获取购物车中的数据
export const reqGetShopCartListData = () => ajax.get('/cart/cartList');

// 8 更改购物车商品的选中状态
export const reqChangeShopCartInfoState = (skuID, isChecked) => ajax.get(`/cart/checkCart/${skuID}/${isChecked}`);

// 9 批量更新购物车的商品选中状态
export const reqChangeAllShopCartInfoState = (skuIdList,isChecked) => ajax({
    url:`cart/batchCheckCart/${isChecked}`,
    method:'post',
    data: skuIdList
});

// 10 删除购物车的一条商品数据
export const reqDelOneShopCartInfo = skuId=> ajax.delete(`/cart/deleteCart/${skuId}`)

// 11 批量删除购物车中的多条数据
export const reqDelSelectedShopCartInfo = skuIdList => ajax.post('/cart/batchDeleteCart',skuIdList)

// 12 获取trade页面中的数据
export const reqGetTradeListData = ()=> ajax.get('/order/auth/trade')

// 13 获取手机验证码
export const reqGetPhoneVerifyCode = (phone)=> ajax.get(`/user/passport/sendCode/${phone}`)

// 14 注册用户
export const reqUserRegister = (user) => ajax.post(`/user/passport/register`, user);

// 15 账户登陆
export const reqUserLogin = (user)=> ajax.post('/user/passport/login',user)

// 16 用户退出
export const reqUserLogout = () => ajax.get('/user/passport/logout');

// 17 获取trade页面中的地址
export const reqGetUserAddressListData =()=> ajax.get('/user/userAddress/auth/findUserAddressList')

// 18 提交商品到付款页面
export const reqSumitOrder = (tradeNo, params) => ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, params)

// 19 获取订单支付信息 也就是支付链接 用支付链接再结合插件实现的二维码图片
export const reqGetOrderPayment = (orderId)=> ajax.get(`/payment/weixin/createNative/${orderId}`)

// 20 查询订单支付状态
export const reqQueryPayStatus = orderId => ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)

// 21 获取订单中心的数据
export const reqGetCenterListData = (page,limit)=> ajax.get(`/order/auth/${page}/${limit}`)